package com.baoyi.widget;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.baoyi.content.content;
import com.baoyi.doamin.ImageItem;
import com.baoyi.pooke.BaoyiApplication;
import com.baoyi.pooke.R;
import com.baoyi.utils.ImageUtil;

public class ListItemWidget extends LinearLayout {

	public ListItemWidget(Context context, ImageItem item) {
		super(context);
		LayoutInflater.from(getContext()).inflate(R.layout.listitem, this);
		imageItem = item;
		String renqi = imageItem.getScore().toString();
		String geili = imageItem.getGeili().toString();
		String bishi = imageItem.getBishi().toString();
		renqiTextView = (TextView) findViewById(R.id.renqiTextView);
		renqiTextView.setText(renqi);
		geiliTextView = (TextView) findViewById(R.id.geiliTextView);
		geiliTextView.setText(geili);
		bishiTextView = (TextView) findViewById(R.id.bishiTextView);
		bishiTextView.setText(bishi);
		remoteImageView = (RemoteImageView) findViewById(R.id.rootimg);
		remoteImageView.setDefaultImage(R.drawable.loading01);
		String url = content.server + imageItem.getSmallmageurl();
		remoteImageView.setImageUrl(url);
	}

	private ImageItem imageItem;

	public ImageItem getImageItem() {
		return imageItem;
	}

	public void setImageItem(ImageItem imageItem) {
		this.imageItem = imageItem;
	}

	private TextView renqiTextView;
	private TextView geiliTextView;
	private TextView bishiTextView;
	private RemoteImageView remoteImageView;
}
